Skip to contentSkip to conversation

Change in openvpn[master]: IPv6 MADDR LOG: Wrap IPv6 addresses in square brackets and include po...

Openvpn-devel In review mrbff (Code Review) 2 participants 8 messages Jan 16, 2025 – Jan 17, 2025 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): gerrit.1737047498000.Ia58cff107d14e29e51df0a988e8337cbb70ebfbb@...2715...

#1 lore raw

Attention is currently required from: flichtenheld, plaisthos.

Hello plaisthos, flichtenheld,

I'd like you to do a code review.
Please visit

    http://gerrit.openvpn.net/c/openvpn/+/870?usp=email

to review the following change.

Change subject: IPv6 MADDR LOG: Wrap IPv6 addresses in square brackets and include port when specified
......................................................................

IPv6 MADDR LOG: Wrap IPv6 addresses in square brackets and include port when specified

- Updated the mroute_addr_print_ex() function to always wrap IPv6 addresses in square brackets for proper formatting.
- Added port printing for IPv6 addresses when specified, e.g., [2001:db8::1]:8080.

Change-Id Ia58cff107d14e29e51df0a988e8337cbb70ebfbb

---
M src/openvpn/mroute.c

1 file changed, 5 insertions(+), 8 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/70/870/1

src/openvpn/mroute.c +5 -8
index f4539dc..91419ed 100644
@@ -430,17 +430,14 @@
                 {
                     buf_printf(&out, "%s", print_in_addr_t(maddr.v4mappedv6.addr,
                                                            IA_NET_ORDER, gc));
-                    /* we only print port numbers for v4mapped v6 as of
-                     * today, because "v6addr:port" is too ambiguous
-                     */
-                    if (maddr.type & MR_WITH_PORT)
-                    {
-                        buf_printf(&out, ":%d", ntohs(maddr.v6.port));
-                    }
                 }
                 else
                 {
-                    buf_printf(&out, "%s", print_in6_addr(maddr.v6.addr, 0, gc));
+                    buf_printf(&out, "[%s]", print_in6_addr(maddr.v6.addr, 0, gc));
+                }
+                if (maddr.type & MR_WITH_PORT)
+                {
+                    buf_printf(&out, ":%d", ntohs(maddr.v6.port));
                 }
                 if (maddr.type & MR_WITH_NETBITS)
                 {

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/870?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ia58cff107d14e29e51df0a988e8337cbb70ebfbb
Gerrit-Change-Number: 870
Gerrit-PatchSet: 1
Gerrit-Owner: mrbff <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newchange

#2 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, mrbff, plaisthos.

cron2 has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/870?usp=email )

Change subject: IPv6 MADDR LOG: Wrap IPv6 addresses in square brackets and include port when specified
......................................................................

Patch Set 1:

(1 comment)

Patchset:

PS1:
I think the patch is fine, technically, but I've spent a bit of thought on it, and want to suggest something else

- in the MR_WITH_PORT case, use "[%s]:%d"
- in the "naked IPv6 address" case, use "%s" only

yes this is yet another extra if(), but my gut feeling is that it would help readability - and for parsers, it should not matter much. If the parser expects to see a port, it will always be [], so no variations.

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/870?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ia58cff107d14e29e51df0a988e8337cbb70ebfbb
Gerrit-Change-Number: 870
Gerrit-PatchSet: 1
Gerrit-Owner: mrbff <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: cron2 <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: mrbff <[email protected]...>
Gerrit-Comment-Date: Fri, 17 Jan 2025 10:38:37 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment

#3 lore raw

[Openvpn-devel] [S] Change in openvpn[master]: IPv6 MADDR LOG: Wrap IPv6 addresses in square brackets and print port...

In reply to a message not in the archive

Attention is currently required from: flichtenheld, mrbff, plaisthos.

Hello flichtenheld, plaisthos,

I'd like you to reexamine a change. Please visit

    http://gerrit.openvpn.net/c/openvpn/+/870?usp=email

to look at the new patch set (#2).

Change subject: IPv6 MADDR LOG: Wrap IPv6 addresses in square brackets and print port when the port is specified
......................................................................

IPv6 MADDR LOG: Wrap IPv6 addresses in square brackets and print port when the port is specified

Updated the mroute_addr_print_ex() function to wrap IPv6 addresses in square brackets and printing the port when the port is specified, e.g., [2001:db8::1]:8080 . When the port is not specified the IPv6 address formatting remain the same, e.g., 2001:db8::1 .

Change-Id Ia58cff107d14e29e51df0a988e8337cbb70ebfbb

---
M src/openvpn/mroute.c

1 file changed, 8 insertions(+), 7 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/70/870/2

src/openvpn/mroute.c +8 -7
index f4539dc..80e18b7 100644
@@ -430,18 +430,19 @@
                 {
                     buf_printf(&out, "%s", print_in_addr_t(maddr.v4mappedv6.addr,
                                                            IA_NET_ORDER, gc));
-                    /* we only print port numbers for v4mapped v6 as of
-                     * today, because "v6addr:port" is too ambiguous
-                     */
-                    if (maddr.type & MR_WITH_PORT)
-                    {
-                        buf_printf(&out, ":%d", ntohs(maddr.v6.port));
-                    }
+                }
+                else if (maddr.type & MR_WITH_PORT)
+                {
+                    buf_printf(&out, "[%s]", print_in6_addr(maddr.v6.addr, 0, gc));
                 }
                 else
                 {
                     buf_printf(&out, "%s", print_in6_addr(maddr.v6.addr, 0, gc));
                 }
+                if (maddr.type & MR_WITH_PORT)
+                {
+                    buf_printf(&out, ":%d", ntohs(maddr.v6.port));
+                }
                 if (maddr.type & MR_WITH_NETBITS)
                 {
                     buf_printf(&out, "/%d", maddr.netbits);

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/870?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ia58cff107d14e29e51df0a988e8337cbb70ebfbb
Gerrit-Change-Number: 870
Gerrit-PatchSet: 2
Gerrit-Owner: mrbff <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: cron2 <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: mrbff <[email protected]...>
Gerrit-MessageType: newpatchset

#4 lore raw

[Openvpn-devel] [S] Change in openvpn[master]: IPv6 MADDR LOG: Wrap IPv6 addresses in square brackets and print port...

In reply to a message not in the archive

Attention is currently required from: flichtenheld, mrbff, plaisthos.

cron2 has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/870?usp=email )

Change subject: IPv6 MADDR LOG: Wrap IPv6 addresses in square brackets and print port when the port is specified
......................................................................

Patch Set 2: Code-Review+2

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/870?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ia58cff107d14e29e51df0a988e8337cbb70ebfbb
Gerrit-Change-Number: 870
Gerrit-PatchSet: 2
Gerrit-Owner: mrbff <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: mrbff <[email protected]...>
Gerrit-Comment-Date: Fri, 17 Jan 2025 11:03:54 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment

#5 lore raw

PATCH v2 1/1 IPv6 MADDR LOG: Wrap IPv6 addresses in square brackets and print port when the port is specified

In reply to a message not in the archive

From: Marco Baffo <[email protected]...>

Updated the mroute_addr_print_ex() function to wrap IPv6 addresses in square brackets and printing the port when the port is specified, e.g., [2001:db8::1]:8080 . When the port is not specified the IPv6 address formatting remain the same, e.g., 2001:db8::1 .

Change-Id Ia58cff107d14e29e51df0a988e8337cbb70ebfbb

---

This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/870
This mail reflects revision 2 of this Change.

Acked-by according to Gerrit (reflected above):
Gert Doering <[email protected]...>

src/openvpn/mroute.c +8 -7
index f4539dc..80e18b7 100644
@@ -430,18 +430,19 @@
                 {
                     buf_printf(&out, "%s", print_in_addr_t(maddr.v4mappedv6.addr,
                                                            IA_NET_ORDER, gc));
-                    /* we only print port numbers for v4mapped v6 as of
-                     * today, because "v6addr:port" is too ambiguous
-                     */
-                    if (maddr.type & MR_WITH_PORT)
-                    {
-                        buf_printf(&out, ":%d", ntohs(maddr.v6.port));
-                    }
+                }
+                else if (maddr.type & MR_WITH_PORT)
+                {
+                    buf_printf(&out, "[%s]", print_in6_addr(maddr.v6.addr, 0, gc));
                 }
                 else
                 {
                     buf_printf(&out, "%s", print_in6_addr(maddr.v6.addr, 0, gc));
                 }
+                if (maddr.type & MR_WITH_PORT)
+                {
+                    buf_printf(&out, ":%d", ntohs(maddr.v6.port));
+                }
                 if (maddr.type & MR_WITH_NETBITS)
                 {
                     buf_printf(&out, "/%d", maddr.netbits);
#6 lore raw

[Openvpn-devel] [PATCH applied] Re: IPv6 MADDR LOG: Wrap IPv6 addresses in square brackets and print port when the port is specified

Thanks for addressing this long-standing itch... not sure why we actually added a comment "back then" explaining why we don't do something, instead of finding a way to actually do it.

I haven't actually looked at the output, only ran client-tests - but the code change is straightforward enough.

Your patch has been applied to the master branch.

commit 5cea4bc75e1b87ec7225a89b7cf5cadb85e77e8a

Author: Marco Baffo
Date:   Fri Jan 17 12:04:22 2025 +0100
     IPv6 MADDR LOG: Wrap IPv6 addresses in square brackets and print port when the port is specified

     Signed-off-by: Marco Baffo <[email protected]...>
     Acked-by: Gert Doering <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg30480.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

#7 lore raw

[Openvpn-devel] [S] Change in openvpn[master]: IPv6 MADDR LOG: Wrap IPv6 addresses in square brackets and print port...

In reply to a message not in the archive

cron2 has uploaded a new patch set (#3) to the change originally created by mrbff. ( http://gerrit.openvpn.net/c/openvpn/+/870?usp=email )

The following approvals got outdated and were removed:
Code-Review+2 by cron2

Change subject: IPv6 MADDR LOG: Wrap IPv6 addresses in square brackets and print port when the port is specified
......................................................................

IPv6 MADDR LOG: Wrap IPv6 addresses in square brackets and print port when the port is specified

Updated the mroute_addr_print_ex() function to wrap IPv6 addresses in square brackets and printing the port when the port is specified, e.g., [2001:db8::1]:8080 . When the port is not specified the IPv6 address formatting remain the same, e.g., 2001:db8::1 .

Change-Id Ia58cff107d14e29e51df0a988e8337cbb70ebfbb

Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg30480.html

---
M src/openvpn/mroute.c

1 file changed, 8 insertions(+), 7 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/70/870/3

src/openvpn/mroute.c +8 -7
index f4539dc..80e18b7 100644
@@ -430,18 +430,19 @@
                 {
                     buf_printf(&out, "%s", print_in_addr_t(maddr.v4mappedv6.addr,
                                                            IA_NET_ORDER, gc));
-                    /* we only print port numbers for v4mapped v6 as of
-                     * today, because "v6addr:port" is too ambiguous
-                     */
-                    if (maddr.type & MR_WITH_PORT)
-                    {
-                        buf_printf(&out, ":%d", ntohs(maddr.v6.port));
-                    }
+                }
+                else if (maddr.type & MR_WITH_PORT)
+                {
+                    buf_printf(&out, "[%s]", print_in6_addr(maddr.v6.addr, 0, gc));
                 }
                 else
                 {
                     buf_printf(&out, "%s", print_in6_addr(maddr.v6.addr, 0, gc));
                 }
+                if (maddr.type & MR_WITH_PORT)
+                {
+                    buf_printf(&out, ":%d", ntohs(maddr.v6.port));
+                }
                 if (maddr.type & MR_WITH_NETBITS)
                 {
                     buf_printf(&out, "/%d", maddr.netbits);

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/870?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ia58cff107d14e29e51df0a988e8337cbb70ebfbb
Gerrit-Change-Number: 870
Gerrit-PatchSet: 3
Gerrit-Owner: mrbff <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: newpatchset

#8 lore raw

[Openvpn-devel] [S] Change in openvpn[master]: IPv6 MADDR LOG: Wrap IPv6 addresses in square brackets and print port...

In reply to a message not in the archive

cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/870?usp=email )

Change subject: IPv6 MADDR LOG: Wrap IPv6 addresses in square brackets and print port when the port is specified
......................................................................

IPv6 MADDR LOG: Wrap IPv6 addresses in square brackets and print port when the port is specified

Updated the mroute_addr_print_ex() function to wrap IPv6 addresses in square brackets and printing the port when the port is specified, e.g., [2001:db8::1]:8080 . When the port is not specified the IPv6 address formatting remain the same, e.g., 2001:db8::1 .

Change-Id Ia58cff107d14e29e51df0a988e8337cbb70ebfbb

Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg30480.html

---
M src/openvpn/mroute.c

1 file changed, 8 insertions(+), 7 deletions(-)
src/openvpn/mroute.c +8 -7
index f4539dc..80e18b7 100644
@@ -430,18 +430,19 @@
                 {
                     buf_printf(&out, "%s", print_in_addr_t(maddr.v4mappedv6.addr,
                                                            IA_NET_ORDER, gc));
-                    /* we only print port numbers for v4mapped v6 as of
-                     * today, because "v6addr:port" is too ambiguous
-                     */
-                    if (maddr.type & MR_WITH_PORT)
-                    {
-                        buf_printf(&out, ":%d", ntohs(maddr.v6.port));
-                    }
+                }
+                else if (maddr.type & MR_WITH_PORT)
+                {
+                    buf_printf(&out, "[%s]", print_in6_addr(maddr.v6.addr, 0, gc));
                 }
                 else
                 {
                     buf_printf(&out, "%s", print_in6_addr(maddr.v6.addr, 0, gc));
                 }
+                if (maddr.type & MR_WITH_PORT)
+                {
+                    buf_printf(&out, ":%d", ntohs(maddr.v6.port));
+                }
                 if (maddr.type & MR_WITH_NETBITS)
                 {
                     buf_printf(&out, "/%d", maddr.netbits);

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/870?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ia58cff107d14e29e51df0a988e8337cbb70ebfbb
Gerrit-Change-Number: 870
Gerrit-PatchSet: 3
Gerrit-Owner: mrbff <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: merged